#include <stdio.h>

#define FILE_NAME "log.txt"

int main() {
    FILE* fp = fopen(FILE_NAME, "w");
    if(fp == NULL) {
        perror("fopen");
        return 1;
    }

    int cnt = 5;
    while(cnt) {
        fprintf(fp, "%s : %d\n", "hello file_operation", cnt--);
    }

    fclose(fp);
    return 0;
}

